<?php
		
	/* SVN FILE: $Id: const.php 8 2011-03-13 08:32:38Z michele.andreoletti@gmail.com $ */
	
	/**
	 * Project Name : arcadia
	 *
	 * @author $Author: michele.andreoletti@gmail.com $
	 * @version $Revision: 8 $
	 * @lastrevision $Date: 2011-03-13 08:32:38 +0000 (Sun, 13 Mar 2011) $
	 * @filesource $URL: http://arcadia.googlecode.com/svn/trunk/include/const.php $
	 */


	if (!isset($sAPP) || !is_string($sAPP) || !isset($aSUITE) || !is_array($aSUITE) || !isset($aSUITE[$sAPP])) {

	   	/**
		 * Intercetto la situazione in cui viene eseguito direttamente questo script (ovvero quando
		 * questo script non e' incluso in $sapp/index.php
		 *
		 */

		header('Location: ../index.php?sMsg=app-not-defined');
		die();
	} 
	
	$sScript = fnCurrentScript();
	$sSCRIPT_ROOT_PATH = (fnIsScriptInRoot() ? '.' : '..'); // Variabile utilizzata in template.php
	
	fnGetValueFromGET(array('sTable'));

	if(!isset($sTable) || !isset($aTABLE[$sTable])) {
		$sTable = fnTableDefault($sTABLE_DEFAULT, $aTABLE);
	}
	
	fnTableConst($sTable);

	
	$iAccessLvl = fnGetAccessLvl('app');
	
	$bSEARCH_FORM_SHOW = false;
	$sJQueryValidateRule = '';

	$sMessageFlash = fnMessageFlash();

	if (is_allowed('sysop', $iAccessLvl)) {

		$sLEFT_NAV_IMG = "terminal.png";
		$sTableTitle = "$sAPP_NAME &raquo; Variabili di Sistema &raquo; $sTableName <span style='font-size: 0.7em'>($sTableDescription)</span>";
		$sHeaderTitle = strip_tags($sTableTitle);

		$sHeadContent = "
			<script type='text/javascript' charset='utf-8'>
	
				$(document).ready(function() {
				
					setTimeout(function(){
						$('.ui-message-flash').fadeOut();
					}, 1800);							

					$('select[name=\"sTable\"]').val('$sTable');

					$('#const-form').change(function() {
						if ($('#const-form #sTable').val() != '') {
							this.submit();
						}
					});
				});
			</script> ";

		$html .= "<div>&nbsp;</div>";
				
		$html .= "<form id='const-form' action='const.php'>";
		$html .= "	<select id='sTable' name='sTable'>";
		$html .= 		fnTablesNamesOptions('all');
		$html .= "	</select>";
		$html .= "</form>";
				
		$html .= '<br/>';
		$html .= print_nice($aTABLE[$sTable]);
		
		if (isset($aVIEW[$aTABLE[$sTable]['sViewItemLink']]) && !empty($aVIEW[$aTABLE[$sTable]['sViewItemLink']])){
			$html .= '<br/>';
			$html .= '<strong>'.$aTABLE[$sTable]['sViewItemLink'].'</strong>';
			$html .= '<br/>';
			$html .= print_nice($aVIEW[$aTABLE[$sTable]['sViewItemLink']]);
		}
		
	} else {
		fnUpdateLog('LOW RIGHTS', 0, '','S');
		header("Location: ./index.php?sMsg=low-rights");
		die();

	}		
	
	require_once('../themes/'.$sTHEME.'/template.php');
	die();
	
?><html><body bgcolor="#fff"></body></html>